﻿using MugenInjection.Delegates;
using MugenInjection.Interface;

namespace MugenInjection.Syntax.Method
{
    /// <summary>
    /// Specific fluent syntax for method binding.
    /// </summary>
    public interface IMethodScopeSyntax : IBindingBuilder
    {
        /// <summary>
        ///  Indicates that instances activated via the custom lifecycle managment.
        /// </summary>
        /// <param name="customScopeDelegate">The specified <see cref="CustomScopeDelegate"/>.</param>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax InScope( CustomScopeDelegate customScopeDelegate);

        /// <summary>
        ///  Indicates that instances activated via the specified lifecycle
        /// </summary>
        /// <param name="scopeLifecycle">The specified <see cref="IScopeLifecycle"/>. </param>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax InScope( IScopeLifecycle scopeLifecycle);

        /// <summary>
        /// Indicates that only a single instance of the binding should be created, and then
        /// should be re-used for all subsequent requests.
        /// </summary>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax InSingletonScope();

        /// <summary>
        /// Indicates that instances activated via the binding should be re-used within the same thread.
        /// </summary>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax InThreadScope();

        /// <summary>
        /// Indicates that instances activated via the binding should not be re-used, nor have their lifecycle managed.
        /// </summary>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax InTransientScope();

        /// <summary>
        ///Indicates that only a single instance of the binding should be created in each <see cref="IInjector"/>, and then
        /// should be re-used for all subsequent requests. 
        /// </summary>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax InUnitOfWorkScope();

        /// <summary>
        ///  Indicates that instances activated via the <see cref="IManagedScope"/> lifecycle managment.
        /// </summary>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax InManagedScope();

        /// <summary>
        /// Indicates that instances activated via the binding should be re-used as weak reference.
        /// </summary>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax InWeakReferenceScope();
    }

    /// <summary>
    /// Specific fluent syntax for method binding.
    /// </summary>
    public interface IMethodScopeSyntax<T> : IBindingBuilder
    {
        /// <summary>
        ///  Indicates that instances activated via the custom lifecycle managment.
        /// </summary>
        /// <param name="customScopeDelegate">The specified <see cref="CustomScopeDelegate"/>.</param>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax<T> InScope(CustomScopeDelegate customScopeDelegate);

        /// <summary>
        ///  Indicates that instances activated via the specified lifecycle
        /// </summary>
        /// <param name="scopeLifecycle">The specified <see cref="IScopeLifecycle"/>. </param>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax<T> InScope(IScopeLifecycle scopeLifecycle);

        /// <summary>
        /// Indicates that only a single instance of the binding should be created, and then
        /// should be re-used for all subsequent requests.
        /// </summary>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax<T> InSingletonScope();

        /// <summary>
        /// Indicates that instances activated via the binding should be re-used within the same thread.
        /// </summary>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax<T> InThreadScope();

        /// <summary>
        /// Indicates that instances activated via the binding should not be re-used, nor have their lifecycle managed.
        /// </summary>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax<T> InTransientScope();

        /// <summary>
        ///Indicates that only a single instance of the binding should be created in each <see cref="IInjector"/>, and then
        /// should be re-used for all subsequent requests. 
        /// </summary>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax<T> InUnitOfWorkScope();

        /// <summary>
        ///  Indicates that instances activated via the <see cref="IManagedScope"/> lifecycle managment.
        /// </summary>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax<T> InManagedScope();

        /// <summary>
        /// Indicates that instances activated via the binding should be re-used as weak reference.
        /// </summary>
        /// <returns>The fluent syntax.</returns>
        IMethodCallbackObjectPriorityUseWithSyntax<T> InWeakReferenceScope();
    }
}